const http = require("../../utils/http3000")
Page({
  data: {
    musics:[]
  },
  onSubmit(event) {
    console.log(event.detail.value);
    var keyword = event.detail.value.name;
    var url = `http://47.108.197.28:3000/search?keywords=${keyword}`
    http({
      url,
      success: res => {
        var musics = []
        console.log(res.data.result.songs);
        var songs = res;
        songs.forEach(item => {
          var { name, id, img1v1Url} = item;
          musics.push({
            name,
            id,
            img1v1Url
          })
        })
        this.setData({
          musics
        })
      }
    })
  },
})